<template>
  <div id="app">
    <div class="preload">
      <div class="container">
        <p class="name">{{systemCode == 'business'?'智厨业务管理系统':'伙食保障精细管理系统'}}</p>
        <p class="title">正在进行页面跳转...</p>
        <p class="sub-title">初次加载资源可能需要较多时间 请耐心等待</p>
      </div>

      <div class="footer">
        <a href="" target="_blank">{{systemCode == 'business'?'智厨业务管理系统':'伙食保障精细管理系统'}}</a>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        systemCode: localStorage.getItem('systemCode'),
      }
    },
    mounted () {
      console.log(this.$route)
      if (this.$route.query.token) {
        this.$store.commit('$uStore', {
          name: 'vuex_user', value: { token: this.$route.query.token }
        })
        this.$cu.eventBus.$emit('onRedirectGet')
      }
      this.$cu.eventBus.$on('onRedirectPush', this.onPush)
    },
    methods: {
      onPush () {
        console.log(this.$route.query.path)
        this.$cu.vuex('show_menu', false)

        console.log(this.$store.state.show_menu)
        this.$router.replace(`/${this.$route.query.path || ''}`)
      }
    }
  }
</script>

<style>
  .preload {
    display: flex;
    flex-direction: column;
    height: 100%;
    letter-spacing: 1px;
    background-color: #2f3447;
  }

  .preload .container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 100%;
    user-select: none;
    flex-grow: 1;
  }

  .preload .name {
    font-size: 30px;
    color: #fff;
    letter-spacing: 5px;
    font-weight: bold;
  }

  .preload .title {
    color: #fff;
    font-size: 14px;
    margin: 20px;
  }

  .preload .sub-title {
    color: #ababab;
    font-size: 12px;
  }

  .preload .footer {
    text-align: center;
    padding: 10px 0 20px 0;
  }

  .preload .footer a {
    font-size: 12px;
    color: #ababab;
    text-decoration: none;
  }
</style>
